Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Programmer's Overview / Part 1 - Getting Started With QuickDraw GX
Chapter 3 - Using QuickDraw GX Objects


Styles

The style object allows you to specify stylistic modifications for your shape objects. Like shape objects, style objects have properties that you can examine and edit. When you draw a shape, QuickDraw GX examines the properties of the shape's style object and modifies the appearance of the shape as indicated by the values of the style object's properties.

Figure 3-24 shows all of the properties of the style object.

Figure 3-24 The style object and its properties

There are four categories of style properties shown in Figure 3-17:

The same style object can be shared by a number of different types of shapes. For example, a line shape, and text shape, and a layout shape can all reference the same style object. When you draw the three shapes, QuickDraw GX
applies the information from the appropriate style properties to each shape.

Geometric Styles

Seven properties of the style object apply primarily to geometric shapes. These properties are the geometric style properties. Figure 3-25 lists these properties and shows examples of how they might affect a simple polygon shape.

Figure 3-25 Geometric style properties

Here is a description of the geometric style properties:

QuickDraw GX provides functions that allow you to examine and modify
each of these properties; for example, GXGetStylePen, GXSetStylePen, GXGetStyleCaps, and GXSetStyleCaps. You provide a reference to the style object for each of these functions.

QuickDraw GX also provides a set of functions that allow you to examine
and modify these properties given a reference to a shape object; for example, GXGetShapePen, GXSetShapePen, GXGetShapeCaps, and GXSetShapeCaps. If the shape shares its style object, QuickDraw GX makes a copy of the style object before modifying its properties.

Bitmap and Picture Styles

Bitmap and picture shapes make much less use of their style objects than do geometric and typographic shapes.

The only part of the style object that bitmap shapes use are the flags in the style attributes property that indicate whether a shape should be constrained to integer positions on the coordinate grid. For example, you can constrain the upper-left corner of a bitmap to an integer grid position.

Picture shapes themselves make no use of their style objects. Although you can still examine and modify the properties of a picture's style object, the values of the properties don't affect the way the picture is drawn.

However, each shape in a picture has its own style object. QuickDraw GX does use the information in those style objects when drawing the picture. Addition-
ally, you can specify an overriding style object for each item in a picture. If an item has an overriding style object, QuickDraw GX uses the information in the overriding style, rather than the original style, when drawing that item as part of the picture.

Typographic and Layout Styles

Style objects also have properties that apply only to typographic shapes, some of which apply only to layout shapes. Figure 3-26 shows these properties and some examples of how they might affect typographic shapes.

Figure 3-26 Typographic style properties

Here is a description of the typographic style properties:

QuickDraw GX provides functions that allow you to examine or modify the value of each of these properties; for example, GXGetStyleFont, GXSetStyleFont, GXGetStyleFace, and GXSetStyleFace.

Here is a description of the layout style properties:

Figure 3-27 shows some examples of the effects of the layout style run controls property.

Figure 3-27 Sample effects of run controls

For more information about typographic and layout styles, see Inside Macintosh: QuickDraw GX Typography.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help